<template>
  <view class="container">
    <z-paging
      ref="paging"
      v-model="itemList"
      @query="queryList"
      :fixed="true"
      :auto="false"
      :auto-show-back-to-top="true"
      :empty-view-img="`${getImageUrl('empty.png')} `"
      empty-view-text="暂无数据~"
      :empty-view-img-style="imgStyle"
    >
      <view slot="top">
        <u-navbar height="50" title="施工信息" title-size="36" title-color="#333"></u-navbar>
      </view>
      <view class="view-area">
        <view
          class="content-box"
          v-for="(item, index) in itemList"
          :key="index"
          @click="
            routeTo(
              '/other/construction-team-case/construction-team-case?info=' + JSON.stringify(item)
            )
          "
        >
          <image
            class="case-cover"
            :src="item.coverUrl"
            width="710rpx"
            height="400rpx"
            mode=""
          ></image>
          <view class="case-desc">
            <view class="content-box-desc">
              {{ item.title }}
            </view>
            <view class="content-box-address">
              {{ formatTime(item.createTime) }}
            </view>
          </view>
        </view>
      </view>
    </z-paging>
    <view class="handle-btn-area">
      <view
        class="handle-btn"
        @click="routeTo('/other_center/cont-team-case-add/cont-team-case-add')"
      >
        <u-icon name="../../static/img/fbxx.png" size="48rpx"></u-icon>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      imgStyle: {
        width: '12rem'
      },

      itemList: [],

      order_id: ''
    }
  },
  onLoad(res) {
    this.queryList()
  },

  computed: {
    formatTime() {
      return (e) => this.$utils.parseTime(e)
    }
  },
  methods: {
    queryList(page = 1, pageSize = 10) {
      this.$u
        .get('/app-api/construction/project-case/my-page', {
          pageNo: page,
          pageSize
        })
        .then((res) => {
          this.$refs.paging.complete(res.data.list)
        })
    },
    onOrderCancel(item) {
      let self = this
      uni.dialog.confirm('温馨提示', '确定要取消订单吗？', () => {
        self.$u.api.setOrderCancel(item.id).the
        setTimeout(function () {
          n((res) => {
            self.$u.toast('取消成功')
            self.onOrderLoad(self.current, null, true)
          }, 500)
        })
      })
    },

    routeTo(url) {
      uni.navigateTo({
        url
      })
    }
  }
}
</script>

<style scoped>
.view-area {
  padding: 20rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.content-box {
  width: 710rpx;
  background-color: #fff;
  margin-top: 20rpx;
}

.content-box-desc {
  margin: 15rpx 0;
  font-size: 32rpx;
}

.case-desc {
  padding: 10rpx 20rpx;
}

.content-box-address {
  color: #999999;
}

.case-cover {
  width: 710rpx;
  height: 400rpx;
}

.handle-btn-area {
  position: fixed;
  right: 20rpx;
  bottom: 150rpx;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.handle-btn {
  margin-bottom: 20rpx;
  width: 100rpx;
  height: 100rpx;
  background-color: #0f76bc;
  border-radius: 100rpx;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
